package com.sy.service.impl;

import com.sy.dao.TypeDao;
import com.sy.dao.impl.TypeDaoImpl;
import com.sy.dto.Result;
import com.sy.entity.Brand;
import com.sy.entity.Type;
import com.sy.service.TypeService;

import java.util.ArrayList;
import java.util.List;

import static com.sy.constant.BusinessConstant.ALL_BRAND_ID;
import static com.sy.constant.BusinessConstant.ALL_TYPE_ID;

public class TypeServiceImpl extends AbstractBaseServiceImpl implements TypeService {
    private TypeDao typeDao = new TypeDaoImpl();

    @Override
    public List<Type> getTypesByBrandId(Integer brandId) {
        List<Type> types = new ArrayList<>();
        Type allType = new Type();
        allType.setId(ALL_TYPE_ID);
        allType.setName("全部");
        types.add(allType);
        types.addAll(typeDao.getTypesByBrandId(brandId));
        return types;
    }
}
